package cn.uniquetech.easyui;

import java.io.File;

public class IconTool {

	private static String icon_path = "D:\\gitpro\\amlss\\amlss\\WebRoot\\static\\easyui\\1.5\\themes\\zdyicons";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		File dir = new File(icon_path);
		if (!dir.exists()) {
			System.out.println("路径不存在!");
			return;
		}

		if (!dir.isDirectory()) {
			System.out.println("不是目录!");
			return;
		}
		
		File[] fs = dir.listFiles();
		String cssstr = "";
		String iconstr = "";
		int i=1;
		for(File file : fs){
			String fname = file.getName();
			String simpleFName = fname.substring(0,fname.lastIndexOf("."));
			cssstr += ".icon-"+simpleFName+" {background: url('zdyicons/"+fname+"') no-repeat center center;}\n\r";
			
			//iconstr +="{\"label\":\""+simpleFName+"\",\"value\":\""+simpleFName+"\"},";
			
			iconstr +="{\"label\":\""+simpleFName+"\",\"value\":\""+simpleFName+"\"},";
		}
		iconstr = "icons:["+iconstr.substring(0,iconstr.length()-1)+"]";
		//cssstr = "icons:["+iconstr.substring(0,cssstr.length()-1)+"]";
		System.out.println(iconstr);

	}

}
